package Q1;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        while (n > 0) {
            n--;
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();

            int min = Math.min(a, c);
            long ret = 0;
            if (min >= b) {
                ret = Math.max(min * 2L, b - 1);
            } else {
                ret = Math.max(min * 2L + (b - min - 1), b - 1);
            }

            System.out.println(ret);
        }
    }
}
